package dao

import (
	"context"
	"test.com/project-user/internal/data"
	"test.com/project-user/internal/database"
	"test.com/project-user/internal/database/gorms"
)

type MemberAccountDao struct {
	conn *gorms.GormConn
}

func (m *MemberAccountDao) SaveMemberAuth(conn database.DbConn, ctx context.Context, sma *data.MemberAccount) error {
	m.conn = conn.(*gorms.GormConn)
	tx := m.conn.Session(ctx)
	err := tx.Create(sma).Error
	return err
}

func NewMemberAccountDao() *MemberAccountDao {
	return &MemberAccountDao{
		conn: gorms.New(),
	}
}
